package top.lucas9.wechat.push.util;

import cn.hutool.core.date.ChineseDate;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Objects;

/**
 * @author lucas9
 * @date 2022/11/26 11:48
 */
public class DateUtil {
    public static final String DATE_TIME_PATTERN = "yyyy-MM-dd HH:mm:ss";

    public static final String DATE_PATTERN = "yyyy-MM-dd";

    private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern(DATE_TIME_PATTERN);
    private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern(DATE_PATTERN);
    public static boolean isSameDay(LocalDateTime dateTime1, LocalDateTime dateTime2) {
        return Objects.equals(dateTime1.format(DATE_FORMATTER), dateTime2.format(DATE_FORMATTER));
    }

    public static boolean isSameDay(LocalDate date1, LocalDate date2) {
        return Objects.equals(date1.format(DATE_FORMATTER), date2.format(DATE_FORMATTER));
    }
}
